//
//  Error.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/15.
//

import Foundation
//错误类型
enum MyError : Error {
    case getJsonFaild//json转换失败
    case nilValueFound(String) //空指针异常
    case invalidParameter(String)//参数错误
    case checkParameter(String,String)//检查错误
    case customize(Int, String)//自定义错误
    case Timeout//参数超时\
    case netFail(Int,String)//网络请求失败
}

enum ERROR : Int {
    case UNKNOWN = -1000 //未知错误
    case TIMEOUT_ERROR = -1001 //连接超时
    case NULL_POINTER_EXCEPTION = -1002 //空指针错误
    case CAST_ERROR = -1004 //类转换错误
    case PARSE_ERROR = -1005 //解析错误
    case ILLEGAL_STATE_ERROR = -1006 //非法数据异常
    case ROOM = -1008 //Room数据库报错
    case DATABASE_OPEN = -1009 //数据库打开异常
    case TASK_CANCEL = -1011 //task取消
    case LC_ERRPR = -1012 //lc 接口报错
    case NET_ERRPR = -1013 // 接口报错
    case CHECK_ERRPR = -1014 // 检查错误
    case UPDAE_API_ERROR = -1000000 //接口需要版本更新

}

public class ServerException {
    var code :Int
    var message: String = ""
    var realMessage: String = ""
    var tag: String? = ""

    init(code: Int, message: String) {
        self.code = code
        self.message = message
    }
}
